<%@ page language="java" contentType="text/html" pageEncoding="utf-8" %>
<%@include file="/WEB-INF/pages/common/common.jsp" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /> 
	<title>上海爱德夏</title>
	<link href="resources/css/loginCss/loginCss.css" rel="stylesheet" type="text/css" />
 </head>
    <%@include file="/WEB-INF/pages/common/head.jsp"%>
    <script type="text/javascript">
    	if(window.parent!=window.self){
    		window.parent.location.replace("${path}/index.do");
    	}
    	var dlcs=0;  
    	$(document).ready(function(){
    		$("#username").focus();
    		$("#sub").click(function(){
    			if(dlcs>=5){
    				$.messager.show({msg : "错误次数太多，稍后再试！",title :"提示"});
    				setTimeout(function(){dlcs=0;}, 10*1000);
    				return;
    			}
    			var uName = $("#username").val();
				var psw = $("#psw").val();
   				if(imonJYRH.isBlank(uName)){
   					$("#username").focus();
   					return;
   				}
   				if(imonJYRH.isBlank(psw)){
   					$("#psw").focus();
   					return;
   				}
				if(!imonJYRH.isBlank(uName)&&!imonJYRH.isBlank(psw)){
   					$.messager.progress({
   						text : '请求数据中....',
   						interval : 100
   					});
   					setTimeout(function(){
   						$.messager.progress('close');
   					},5000);
					$.ajax({
						url : imonJYRH.url("${path}/ajaxLogin.do"),
						data :$("#forms *").serializeArray(),
						async : true,
						success : function(reMsg) {
							$.messager.progress('close');
							try{
								if(reMsg.success){
									window.location.replace("${path}/main.do");
								}else{
									$.messager.show({msg : reMsg.msg,title :'提示'});
									$("#username").val("");
									$("#psw").val("");
									$("#username").focus();
								}
							}catch (e) {
								$.messager.show({msg : '操作失败！',title :'提示'});
							}
							dlcs++;
						}
					});
    			}
    		});
    		//绑定处理回车事件
    		$("#username").keyup(function(event){
    			if("13"==event.keyCode){
    				$("#psw").focus();
    				return false;
    			}
    		});
    		//绑定处理回车事件
    		$("#psw").keyup(function(event){
    			if("13"==event.keyCode){
    				$("#sub").trigger("click");
    				return false;
    			}
    		});
    		$("#res").click(function(){
    			$("#username").val("");
    			$("#psw").val("");
    		});
    	});
    </script>
<body>
<div class="login1" style="background-image: url('resources/img/login/login2.jpg');">
  <table width="100%" border="0" cellspacing="0" cellpadding="0"  id="forms"> 
    <tr>
      <td align="center"><table width="500" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td height="140">&nbsp;</td>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td width="30">&nbsp;</td>
          <td height="38" align="center">用户名：
            <input name="name" id="username" type="text" id="username" style="border: 1px black solid;" value=""/></td>
          <td width="30">&nbsp;</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td height="38" align="center">密    &nbsp;码：
             <input id="psw" name="password" type="password" id="password" style="border: 1px black solid;"  value=""/></td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td>&nbsp;</td>
          <td  height="38" align="center">&nbsp;<font color="red"></font></td>
          <td>&nbsp;</td>
        </tr>
      <tr>
          <td>&nbsp;</td>
          <td height="38" align="center">
          <img id="sub"   src="resources/img/login/button.png">
          <img id="res" src="resources/img/login/button1.png">
          </td>
          <td>&nbsp;</td>
        </tr>
      </table></td>
    </tr>
  </table>
</div>
</body>
</html>
